package com.car.Test;

import com.car.dao.PurchaseRecordDao;
import com.car.dao.impl.PurchaseRecordImpl;
import com.car.domain.PurchaseRecord;
import org.junit.Test;

import java.util.List;

public class PurchaseRecordImplTest {
    private static final PurchaseRecordDao purchaseRecordDao=new PurchaseRecordImpl();
    @Test
    public void add() throws Exception {
        PurchaseRecord pr=new PurchaseRecord();
        pr.setUserId(1);
        pr.setCarId(888);
        pr.setEmployeeId(10001);
        pr.setPurchaseDate(new java.util.Date());
       purchaseRecordDao.add(pr);
    }

    @Test
    public void delete() throws Exception {
        int delete=purchaseRecordDao.delete(1);
    }

    @Test
    public void update() throws Exception {
        PurchaseRecord pr=purchaseRecordDao.queryById(1);
        pr.setCarId(2);
        purchaseRecordDao.update(pr);
    }

    @Test
    public void queryById() throws Exception {
        PurchaseRecord pr= purchaseRecordDao.queryById(1);
        System.out.println(pr);
    }

    @Test
    public void queryAll() throws Exception {
        List<PurchaseRecord> pr = purchaseRecordDao.queryAll();
        System.out.println(pr);
    }

}